package com.imooc.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import com.imooc.dto.User;
import com.imooc.dto.UserQueryCondition;

@Service
public class UserService {

	
	public List<User> getUsers(UserQueryCondition condition, Pageable pageable) {
		System.out.println("参数condition：" + condition.toString());
		System.out.println("参数pageable：" + pageable.toString());
		List<User> users = new ArrayList<>();
		User u1 = new User(1, "Jason", "qwert", "111111", 23);
		User u2 = new User(2, "Peter", "asdfg", "222222", 22);
		User u3 = new User(3, "Katlin", "zxcvb", "333333", 26);
		User u4 = new User(4, "Jack", "dfhjk", "444444", 23);
		users.add(u1);
		users.add(u2);
		users.add(u3);
		users.add(u4);
		return users;
	}
	
	
	public User getInfo(String id) {
		return new User(1, "Jason", "qwert", "111111", 23);
	}
	
	public boolean hasUserInDb(String loginName) {
		if("qwert".equals(loginName)) {
			return true;
		}
		return false;
	}
	
}
